package phoneyzm.util;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class ConstantPropertiesUtils implements InitializingBean {
    @Value("${aliyun.sms.accessKeyId}")
    private String accessKeyId;
    @Value("${aliyun.sms.accessKeySecret}")
    private String accessKeySecret;
    @Value("${aliyun.sms.signName}")
    private String signName;
    @Value("${aliyun.sms.templateCode}")
    private String templateCode;
    @Value("${aliyun.sms.product}")
    private String product;
    @Value("${aliyun.sms.doMain}")
    private String doMain;
    @Value("${aliyun.sms.regionId}")
    private String regionId;
    @Value("${aliyun.sms.templateParam}")
    private String templateParam;

    public static String ACCESS_KEY_ID;
    public static String ACCESS_KEY_SECRET;
    public static String SIGN_NAME;
    public static String TEMPLATE_CODE;
    public static String PRODUCT;
    public static String DO_MAIN;
    public static String REGION_ID;
    public static String TEMPLATE_PARAM;

    @Override
    public void afterPropertiesSet() throws Exception {
        ACCESS_KEY_ID = accessKeyId;
        ACCESS_KEY_SECRET = accessKeySecret;
        SIGN_NAME = signName;
        TEMPLATE_CODE = templateCode;
        PRODUCT = product;
        DO_MAIN = doMain;
        REGION_ID = regionId;
        TEMPLATE_PARAM = templateParam;
    }
}
